#include "log.h"

Log::Log()
{
    logFileName = "./log/travian.log";
    logFile = new QFile(logFileName);
    if (!logFile->open(QIODevice::Text | QIODevice::Append))
    {
        return;
    }
    out.setDevice(logFile);
}

Log::~Log()
{
    logFile->close();
    delete logFile;
}

// TODO: межет надо добавить еще неизвестное количество аргументов
void Log::write(const QString &str)
{
    out << "["
        << QDateTime::currentDateTime().toString("dd.MM.yyyy hh:mm:ss")
        << "] " << str <<  endl;
}
